import {testNetWork} from "./env"
import { ethers, providers, utils } from "ethers";
export async function bigNumber() {
    const main = async () => {
      // 0. js 最大安全整数
      console.log('js最大安全整数', Number.MAX_SAFE_INTEGER)
      // 1. 十进制的字符串转bigNumber
      const bigNumber = ethers.BigNumber.from('10000000')
      console.log(bigNumber)
      // 2. 从 hex 字符串生成
      console.log(ethers.BigNumber.from('0x989680'))
      // 3. 从 数字生成
      console.log(ethers.BigNumber.from(10000000))
      // 运算
      console.log('加法', bigNumber.add(1).toString())
      console.log('减法', bigNumber.sub(1).toString())
      console.log('乘法', bigNumber.mul(2).toString())
      console.log('除法', bigNumber.div(2).toString())
      // 比较
      console.log('是否相等', bigNumber.eq(10000000))
    }
    main()
}